export const rolesList: any = [];

export const typeList: any = [
  {
    label: 'A端(商户端)',
    value: 'a',
  },
  {
    label: 'B端(商家端)',
    value: 'b',
  },
  {
    label: 'C端(用户端)',
    value: 'c',
  },
];

export const formSchema: any = [
  {
    field: 'account',
    label: '注册账号',
    component: 'Input',
    required: true,
  },
  {
    field: 'role_id',
    label: '角色分配',
    component: 'ApiSelect',
    componentProps: {
      placeholder: '请选择角色',
      options: rolesList,
    },
    required: true,
    // colProps: {
    //   offset: 2,
    // },
  },
  {
    field: 'type',
    label: '注册使用',
    component: 'ApiSelect',
    componentProps: {
      placeholder: '请选择哪个端注册',
      options: typeList,
    },
    required: true,
  },
  {
    field: 'head_img',
    label: '用户头像',
    component: 'Input',
    required: true,

    defaultValue:
      'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fsafe-img.xhscdn.com%2Fbw1%2F9e8bd863-bf16-4647-abf0-88490ce78ced%3FimageView2%2F2%2Fw%2F1080%2Fformat%2Fjpg&refer=http%3A%2F%2Fsafe-img.xhscdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1692239797&t=a656713f3185954147d0d361bef4b02d',
  },
  {
    field: 'nickName',
    label: '用户昵称',
    component: 'Input',
    required: true,
    defaultValue: '',
  },

  {
    field: 'phone',
    label: '手机号码',
    component: 'Input',
    required: true,
    defaultValue: '',
  },

  {
    field: 'password',
    label: '账号密码',
    component: 'StrengthMeter',
    componentProps: {
      placeholder: '账号密码',
    },
    rules: [
      {
        required: true,
        message: '请输入新密码',
      },
    ],
  },
  {
    field: 'confirmPassword',
    label: '确认密码',
    component: 'InputPassword',

    dynamicRules: ({ values }) => {
      return [
        {
          required: true,
          validator: (_, value) => {
            if (!value) {
              return Promise.reject('密码不能为空');
            }
            if (value !== values.password) {
              return Promise.reject('两次输入的密码不一致!');
            }
            return Promise.resolve();
          },
        },
      ];
    },
  },

  {
    field: 'status',
    label: '状态',
    component: 'Input',
    required: true,
    defaultValue: 'normal',
    dynamicDisabled: true,
  },
];
